/**
 * 
 * 防抖函数
 * @param func 函数
 * @param wait 等待时间
 * @returns 
 */
export function debounce(func: Function, wait: number) {
  let timeout: number | undefined;
  return function(this: any, ...args: any[]) {
    clearTimeout(timeout);
    timeout = window.setTimeout(() => {
      func.apply(this, args);
    }, wait);
  };
}